package com.lucy.nepu.module.taward.converter;

import com.lucy.common.utils.JsonUtil;
import com.lucy.nepu.module.topic.model.ExtParams;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

@Converter
public class ExtParamsConverter implements AttributeConverter<ExtParams,String> {

    @Override
    public String convertToDatabaseColumn(ExtParams extParams) {
        return JsonUtil.obj2String(extParams);
    }

    @Override
    public ExtParams convertToEntityAttribute(String s) {
        return JsonUtil.string2Obj(s,ExtParams.class);
    }
}
